﻿<Window x:Class="ViewModel.RegistrationView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="ViewModel Example"
        SizeToContent="Height"
        Width="400">
    <DockPanel Margin="8 0">

        <TextBlock Text="Register"
                   TextWrapping="Wrap"
                   DockPanel.Dock="Top"
                   FontWeight="Bold"
                   FontSize="20" />

        <Button IsEnabled="{Binding IsFormValid}"
                Content="Register"
                Click="Button_Click"
                HorizontalAlignment="Right"
                VerticalAlignment="Bottom"
                DockPanel.Dock="Bottom"
                Margin="0 8" />

        <ItemsControl x:Name="ValidationSummary"
                      ItemsSource="{Binding ValidationErrors}"
                      DockPanel.Dock="Right"
                      Width="150"
                      Margin="8 0 0 0"
                      BorderThickness="0"
                      BorderBrush="{x:Null}"
                      Foreground="#FFFF0000">
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <TextBlock TextWrapping="Wrap"
                               Text="{Binding}" />
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
        
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="*" />
                <RowDefinition Height="*" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>

            <Label>Email</Label>
            <TextBox Text="{Binding Email}" 
                     Grid.Column="1" />

            <Label Grid.Row="1">Password</Label>
            <TextBox Text="{Binding Password}"
                     Grid.Row="1"
                     Grid.Column="1" />

            <Label Grid.Row="2">Confirm</Label>
            <TextBox Text="{Binding Confirm}"
                     Grid.Row="2"
                     Grid.Column="1" />
        </Grid>
    </DockPanel>
</Window>
